<%@page import="serializare.SerializationToXml"%>
<%@page import="java.util.List"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.Enumeration"%>
<%@page import="bean.Person"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="mytag" uri="/WEB-INF/CustomTagDiscriptor.tld"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>

<script type="text/javascript">
	function enableButton() {
		var ids = document.getElementsByName("id");
		var deleteButton = document.getElementsByName("delete")[0];
		deleteButton.disabled = true;
        for (i = 0; i < ids.length; i++){
			if (ids[i].checked == true) {
				deleteButton.disabled = false; 
				break;
			} 
        }
	}
</script>

</head>
<%
    List<Person> persons = SerializationToXml.deserializeXMLToObject();
%>
<body onload="enableButton();">
	<form action="ActionController" method="POST" name="description">
	   <table>
	   <br>
	   <tr>
	    	<input type="hidden" name="event" value="returnHome" /> 
			<input type="submit" value="Return Home" name="return" />
		</tr>
		</table>
	</form>
	<form action="ActionController" method="POST" name="description">
		<input type="hidden" name="event" value="deletePerson" /> 
		<input type="submit" value="Delete Person" name="delete">
		<mytag:personsList persons="<%=persons%>" boldHeader="false" displayHeader="true" title="Persons list" />
	</form>
</body>
</html>